# -*- coding: utf-8 -*-
"""
Created on Wed Aug 14 09:21:21 2013

@author: Jeanhwea
"""

import smtplib

#if len(sys.argv) < 1:
#    return
filebase = '../inputfile/'
ary_snd = []
ary_psw = []
with open(filebase+'sender.txt') as f_snd:
    for line in f_snd:
        ary_snd.append(line.split()[0])
        ary_psw.append(line.split()[1])
f_snd.close()
size_snd = len(ary_snd)

host = 'smtp.126.com'
sec = 1
for index in range(size_snd):
    smtp = smtplib.SMTP()
    smtp.connect(host)
    try :
        recod, remesg = smtp.login(ary_snd[index], ary_psw[index])
        print '**** ', sec
        sec += 1
        #print ary_snd[index], ary_psw[index]
    except Exception, e:
        print(ary_snd[index], ary_psw[index])
        pass
    smtp.quit()